<!-- 数据库记录删除-->
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@page import="java.sql.*" %>
<%@page import="org.edu.system.DBConnect" %>
<%@page import="org.edu.system.LogWriter" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Delete</title>
</head>
<body>
	<%
		String adm_id = (String) (session.getAttribute("UserName"));
		PreparedStatement pst = null;
		int rs = 0;
		String id = request.getParameter("id");//获取上个页面传来的id
		String sql = "DELETE FROM student WHERE stu_id = '" + id + "'";//创建sql语句
		System.out.println(sql);
		try {

			Connection con = DBConnect.getCon();//获取数据库连接
			System.out.println(sql);
			pst = con.prepareStatement(sql);
			rs = pst.executeUpdate();//执行命令
			if (rs != 0)// 如果记录为空，表明目标记录已删除
			{
				LogWriter.LogPrint("["+request.getRemoteAddr()+"] "+adm_id+" 删除 "+id+" 学生记录成功！");
				out.println("删除成功");
			} else {
				// 否则删除失败
				LogWriter.LogPrint("["+request.getRemoteAddr()+"] "+adm_id+" 删除 "+id+" 学生记录失败！");
				out.println("删除失败");
			}
	%>
	<jsp:forward page="adm_student_info.jsp">
		<jsp:param name="ids" value="id" />
	</jsp:forward>
	<%
		} catch (Exception e) {
			out.println(e);
		}
	%>
</body>
</html>